from django.urls import path
from .views import (
    CategoryListView, TagListView, BookListView, BookDetailView,
    BookCreateView, BookUpdateView, BookDeleteView,
    BookReviewListView, BookReviewCreateView,
    BookReviewAdminListView, BookReviewApproveView,
    book_helpful_vote, featured_books, related_books
)

urlpatterns = [
    path('categories/', CategoryListView.as_view(), name='category-list'),
    path('tags/', TagListView.as_view(), name='tag-list'),
    path('books/', BookListView.as_view(), name='book-list'),
    path('books/featured/', featured_books, name='featured-books'),
    path('books/<str:slug>/', BookDetailView.as_view(), name='book-detail'),
    path('books/<str:slug>/related/', related_books, name='related-books'),
    path('admin/books/', BookCreateView.as_view(), name='book-create'),
    path('admin/books/<str:slug>/', BookUpdateView.as_view(), name='book-update'),
    path('admin/books/<str:slug>/delete/', BookDeleteView.as_view(), name='book-delete'),
    
    path('books/<str:book_slug>/reviews/', BookReviewListView.as_view(), name='book-reviews'),
    path('books/<str:book_slug>/reviews/create/', BookReviewCreateView.as_view(), name='book-review-create'),
    path('admin/reviews/', BookReviewAdminListView.as_view(), name='book-review-admin-list'),
    path('admin/reviews/<int:pk>/approve/', BookReviewApproveView.as_view(), name='book-review-approve'),
    path('reviews/<int:review_id>/vote/', book_helpful_vote, name='book-review-vote'),
]
